package com.cndw.kungfu.vo;

import java.util.HashMap;

import com.cndw.kungfu.config.ConstantsIntKey;
import com.cndw.kungfu.domain.Player;
import com.cndw.kungfu.domain.Union;
import com.cndw.kungfu.model.Context;
import com.cndw.kungfu.model.CrossProxySerialize;
import com.cndw.kungfu.model.activity.holiday.HalloweenCore;

/**
 * 用于同屏角色信息
 * 
 * @author fantadust
 * 
 */

public class ScenePlayerVO extends HashMap<String, Object> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 583730060826263028L;

	/**
	 * 玩家id
	 */
	public long id;

	/**
	 * 玩家名称
	 */
	public String name;
	/**
	 * 当前等级
	 */
	public int level;
	/**
	 * 职业id
	 */
	public int vocationId;

	/**
	 * 当位置
	 */
	public int x;

	public int y;

	// 目标位置

	public int tx = 0;

	public int ty = 0;

	/**
	 * 当前装备
	 */
	public String dress;

	/**
	 * 帮派Id
	 */
	public int unionId;
	/**
	 * 状态 0 无.1 战斗 2.决斗 3 刺杀
	 */

	public int state;
	/**
	 * 队伍id
	 */
	public int teamId;

	public ScenePlayerVO(Player player) {
		id = player.getPlayerId();
		name = player.getPlayerName();
		level = player.getLevel();
		vocationId = player.getVocationId();
		x = player.getX();
		y = player.getY();
		if (player.getTs() == 0) {
			tx = player.getTx();
			ty = player.getTy();
		}
		dress = player.getDress();
		unionId = player.getUnionId();
		if (unionId > 0) {
			Union union = Context.getUnionServer().getUnionById(unionId);
			if (union != null) {
				put("un", union.getName());
			}
		}

		state = player.getState();
		teamId = player.getTeamId();

		if (player.getKnightTrueLevel() > 0) {
			put("k", player.getKnightLevel());
		}
		if (player.getDataInfo().getPet() != null) {
			put("ps", player.getDataInfo().getPet().getModeId());
			put("pn", player.getDataInfo().getPet().getName());
			int tbs = HalloweenCore.getTBS(player.getPlayerId());
			if (tbs > 0) {
				put("tbs", tbs);
			}
		}
		if (player.getDataInfo().getYLevel() > 0) {
			put("yl", player.getDataInfo().getYLevel());
			if (player.getDataInfo().isYYear()) {
				put("yy", 1);
			}
		}

		if (player.getTitleId() > 0) {
			put("tn", player.getTitleId());
		}
		int hd = CrossProxySerialize.getInstance().worldHidGet(id);
		if (hd > 0 ) {
			put("hd", hd);
		}
		int gj = player.getDataInfo().intDataGet(ConstantsIntKey.gj);
		if (gj > 0 ) {
			put("gj", gj);
		}
		
	}

}
